package com.example.mapper;

import com.example.entity.Prise;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 操作prise相关数据接口
*/
public interface PriseMapper {

    void insert(Prise prise);
    /**
      * 删除
    */
    int deleteById(Integer id);

    /**
      * 修改
    */
    int updateById(Prise prise);

    /**
      * 根据ID查询
    */
    Prise selectById(Integer id);

    /**
      * 查询所有
    */
    List<Prise> selectAll(Prise prise);

    @Delete("delete from prise where fid = #{fid} and user_id = #{userId}")
    void deleteByFidAndUserId(@Param("fid") Integer fid, @Param("userId") Integer userId);

    @Select("select * from prise where fid = #{fid} and user_id = #{userId}")
    Prise selectByFidAndUserId(@Param("fid") Integer fid, @Param("userId") Integer userId);

    @Select("select count(*) from prise where fid = #{fid}")
    Integer selectCount(Integer fid);


}
